package com.inspinia.message.common.model;


import com.inspinia.base.common.model.NameCodeEnum;

/**
 * 关联类型
 * 每个不同实体code之间预留100位
 * @author Veblen
 */
public enum NoticeLinkType implements NameCodeEnum {

    sys(1, "系统消息", NoticeClientsCombination.JUST_WEB),
    kickOutSession(2, "注销当前用户", NoticeClientsCombination.JUST_WEB),
    noticeCount(3, "消息总数", NoticeClientsCombination.WEB_AND_APP),
    businessException(4,"业务异常", NoticeClientsCombination.WEB_AND_APP);

    private final int code;
    private final String name;
    private final NoticeClientsCombination clientCombination;

    NoticeLinkType(int code, String name, NoticeClientsCombination clientCombination) {
        this.code = code;
        this.name = name;
        this.clientCombination = clientCombination;
    }

    @Override
    public int getCode() {
        return this.code;
    }

    @Override
    public String getName() {
        return this.name;
    }

    public NoticeClientsCombination getClientCombination() {
        return clientCombination;
    }

    public static NoticeLinkType valueOf(int code) {
        for (NoticeLinkType rs : NoticeLinkType.values()) {
            if (rs.getCode() == code) {
                return rs;
            }
        }
        return null;
    }

}

